package com.example.learnjob.service;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class RunJob {
    public static void main(String[] args) throws InterruptedException {
        ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(10);
        scheduledExecutorService.scheduleAtFixedRate(new Job(), 0, 1000, TimeUnit.MILLISECONDS); // 不受上一个任务的影响
        Thread.sleep(10000);
        System.out.println("主线程执行完毕");
    }
}
